﻿using System;
using System.Collections.Generic;

namespace Ext.Net.UIS
{
    public class GridEditor : TermEditor
    {
        public static GridEditor Default = new GridEditor();

        public override IEnumerable<AbstractComponent> NewControls(TermNode node, UisCreateControlArgs e)
        {
            var store = node.Store;
            if (store == null)
                throw new NullReferenceException("The node.Path must be implement interface IUisStoreContainer. Store is null.");


            var grid = new Grid
            {
                TermNode = node,
                ViewState = e.BaseViewState,
            };

            e.BaseViewState = null;
            grid.CreateControls(e);

            return new[] { grid };
        }

        
    }
}
